<template>
    <div class="app-container home">
        <div id="saleBie" style="width: 100%;height: 400px">

        </div>
        <div id="profitBie" style="width: 100%;height: 400px">

        </div>

        <div id="comBie" style="width: 100%;height: 400px">

        </div>

        <el-row :gutter="20">
            <el-col :sm="24" :lg="12" style="padding-left: 20px">
                <h2>超市管理系统</h2>
                <p>
                    随着零售行业的快速发展和顾客需求的不断变化,超市管理系统已成为提高运营效率和客户体验的关键工具。本系统将为某大型连锁超市提供一体化的管理解决方案,涵盖员工管理、商品管理、库存管理、销售管理和数据分析等多个模块。
                    员工是超市运营的核心力量,合理管理员工信息有助于提高工作效率。该系统将为管理员提供员工用户管理和查询功能,确保员工信息的准确性和可及性。
                    商品管理是超市业务的重心。系统将实现商品信息的增删改查,让员工和顾客能够快速获取商品详情。同时,货架管理功能将帮助顾客轻松找到所需商品。
                    销售环节是超市创收的关键,系统将提供直观的商品销售界面,自动计算每笔交易利润,为管理层决策提供数据支撑。进货管理则有助于保证货品充足,避免缺货情况。
                    为进一步提升竞争力,系统将具备销售数据分析功能,分析销售趋势和商品关联性,为超市制定营销策略提供依据。
                    总之,该超市管理系统将全方位提升超市的管理水平,优化运营流程,为顾客带来更佳的购物体验,助力超市实现可持续发展
                </p>
                <p>
                    <b>当前版本:</b> <span>{{ version }}</span>
                </p>
                <p>
                    <el-tag type="danger">若以框架二次开发</el-tag>
                </p>
                <p>
                    <el-button type="primary" size="mini" icon="el-icon-cloudy" plain
                        @click="goTarget('https://gitee.com/faye-spike/supermarket-management')">访问项目仓库</el-button>
                    <el-button size="mini" icon="el-icon-s-home" plain
                        @click="goTarget('https://gitee.com/faye-spike')">访问主页</el-button>
                </p>
            </el-col>

            <el-col :sm="24" :lg="12" style="padding-left: 50px">
                <el-row>
                    <el-col :span="12">
                        <h2>技术选型</h2>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="6">
                        <h4>后端技术</h4>
                        <ul>
                            <li>SpringBoot</li>
                            <li>Spring Security</li>
                            <li>JWT</li>
                            <li>MyBatis</li>
                            <li>Druid</li>
                            <li>...</li>
                        </ul>
                    </el-col>
                    <el-col :span="6">
                        <h4>前端技术</h4>
                        <ul>
                            <li>Vue</li>
                            <li>Element-ui</li>
                            <li>Axios</li>
                            <li>...</li>
                        </ul>
                    </el-col>
                </el-row>
            </el-col>
        </el-row>
        <el-divider />
        <el-row :gutter="20">
            <el-col :xs="24" :sm="24" :md="12" :lg="8">
                <el-card class="update-log">
                    <div slot="header" class="clearfix">
                        <span>联系信息</span>
                    </div>
                    <div class="body">
                        <p>
                            <i class="el-icon-s-promotion"></i> 官网：<el-link href="https://theghostintheshell.jp/"
                                target="_blank">YMO超市</el-link>
                        </p>
                        <p>
                            <i class="el-icon-user-solid"></i> thanks for：<a href="https://theghostintheshell.jp/"
                                target="_blank">Y.M.O</a>
                        </p>
                        <!--  <p>
              <i class="el-icon-chat-dot-round"></i> 微信：<a href="javascript:;">/ *若依</a>
            </p>
            <p>
              <i class="el-icon-money"></i> 支付宝：<a href="javascript:;" class="支付宝信息">/ *若依</a>
            </p> -->
                    </div>
                </el-card>
            </el-col>
            <el-col :xs="24" :sm="24" :md="12" :lg="8">
                <el-card class="update-log">
                    <div slot="header" class="clearfix">
                        <span>营业日程</span>
                    </div>
                    <el-collapse accordion>
                        <el-collapse-item title="2019-10-08">
                            <ol>
                                <li>超市正式开业</li>
                            </ol>
                        </el-collapse-item>
                    </el-collapse>
                </el-card>
            </el-col>

            <el-col :xs="24" :sm="24" :md="12" :lg="8">
                <el-card class="update-log">
                </el-card>
            </el-col>
        </el-row>


    </div>


</template>

<script>
import * as echarts from 'echarts';
import request from '@/utils/request';

export default {
    name: "Index",
    data() {
        return {
            // 版本号
            version: "初号机"
        };
    },
    mounted(){
       //this.findNotice();
       //this.initBie();
        if (this.$store.state.user.name=="admin")
        this.initEcharts();
        //console.log(this.$store.state.user.name)
        
    },
    methods: {
        goTarget(href) {
            window.open(href, "_blank");
        },
        initEcharts(){
            request.get("/supermarket/sale/echarts/bie").then(res=>{
                if(res.code==1){
                   // console.log(res.mode)
                   this.$modal.msgError(res.msg);
                }else {
                   // console.log(res.data);
                    this.initSaleBie(res.data); 
                    
                }
            })

            request.get("/supermarket/sale/echarts/profitBie").then(res => {
                if (res.code == 1) {
                    // console.log(res.mode)
                    this.$modal.msgError(res.msg);
                } else {
                    // console.log(res.data);
                    this.initProfitBie(res.data);
                }
            })

            request.get("/supermarket/commodity/echarts/stockBar").then(res => {
                if (res.code == 1) {
                     //console.log(res.mode)
                    this.$modal.msgError(res.msg);
                } else {
                    // console.log(res.data);
                    this.initComBie(res.data);
                }
            })




        },
        initSaleBie(data){
            let chartDom = document.getElementById('saleBie');
            let myChart = echarts.init(chartDom);
            let option;

            option = {
                title: {
                    text: '超市商品销售统计',
                    subtext: '分类统计',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left'
                },
                series: [
                    {
                        name: '商品分类',
                        type: 'pie',
                        radius: '50%',
                        data: data,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };

            option && myChart.setOption(option);
        },
        initProfitBie(data) {
            let chartDom = document.getElementById('profitBie');
            let myChart = echarts.init(chartDom);
            let option;

            option = {
                title: {
                    text: '超市商品销售利润统计',
                   // subtext: '分类统计',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left'
                },
                series: [
                    {
                        name: '商品分类',
                        type: 'pie',
                        radius: '50%',
                        data: data,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };

            option && myChart.setOption(option);
        },
        initComBie(data){
            let chartDom = document.getElementById('comBie');
            let myChart = echarts.init(chartDom);
            let option;

            option = {
                title: {
                    text: '超市商品库存统计',
                    subtext: '分类统计',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                xAxis: {
                    type: 'category',
                    data: data.nameList,
                    axisLabel: {
                        interval: 0,//代表显示所有x轴标签显示
                    }


                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        data: data.stockList,
                        type: 'bar'
                    }
                ]
            };

            option && myChart.setOption(option);

        }
    }
};
</script>

<style scoped lang="scss">
.home {
    blockquote {
        padding: 10px 20px;
        margin: 0 0 20px;
        font-size: 17.5px;
        border-left: 5px solid #eee;
    }

    hr {
        margin-top: 20px;
        margin-bottom: 20px;
        border: 0;
        border-top: 1px solid #eee;
    }

    .col-item {
        margin-bottom: 20px;
    }

    ul {
        padding: 0;
        margin: 0;
    }

    font-family: "open sans",
    "Helvetica Neue",
    Helvetica,
    Arial,
    sans-serif;
    font-size: 13px;
    color: #676a6c;
    overflow-x: hidden;

    ul {
        list-style-type: none;
    }

    h4 {
        margin-top: 0px;
    }

    h2 {
        margin-top: 10px;
        font-size: 26px;
        font-weight: 100;
    }

    p {
        margin-top: 10px;

        b {
            font-weight: 700;
        }
    }

    .update-log {
        ol {
            display: block;
            list-style-type: decimal;
            margin-block-start: 1em;
            margin-block-end: 1em;
            margin-inline-start: 0;
            margin-inline-end: 0;
            padding-inline-start: 40px;
        }
    }
}
</style>
